	.module key_iccavr.c
	.area text(rom, con, rel)
	.dbfile D:\01.Projects\JKElectronics\ATMEGA\CoreModule\sw\examples\basic\key_iccavr\key_iccavr.c
	.area data(ram, con, rel)
	.dbfile D:\01.Projects\JKElectronics\ATMEGA\CoreModule\sw\examples\basic\key_iccavr\key_iccavr.c
_s_key:
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile D:\01.Projects\JKElectronics\ATMEGA\CoreModule\sw\examples\basic\key_iccavr\key_iccavr.c
	.dbsym s s_key _s_key c
_s_exit:
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile D:\01.Projects\JKElectronics\ATMEGA\CoreModule\sw\examples\basic\key_iccavr\key_iccavr.c
	.dbsym s s_exit _s_exit c
	.area text(rom, con, rel)
	.dbfile D:\01.Projects\JKElectronics\ATMEGA\CoreModule\sw\examples\basic\key_iccavr\key_iccavr.c
	.dbfunc e gpio_polling_key _gpio_polling_key fV
	.even
_gpio_polling_key::
	.dbline -1
	.dbline 10
;   
; #include "hw_config.h"
; #include "led.h"
; #include "key.h"
; 
; static volatile u8 s_key = 0;
; static volatile u8 s_exit = 0;
; 
; void gpio_polling_key(void)
; {
	.dbline 11
; 	s_exit = 0;
	clr R2
	sts _s_exit,R2
	xjmp L9
L8:
	.dbline 14
; 
; 	while(!s_exit)
; 	{
	.dbline 16
; 
; 		if( !inp(USER_KEY1_PIN, USER_KEY1_PIN_NO) && !(s_key & KEY_KEY1) )
	sbic 0x13,7
	rjmp L11
X0:
	lds R2,_s_key
	sbrc R2,0
	rjmp L11
X1:
	.dbline 17
; 		{
	.dbline 19
; 			// usart_puts("Key1 Pressed.\r\n");
; 			bsp_led_core_on(ledUserCore);
	clr R16
	xcall _bsp_led_core_on
	.dbline 20
; 			s_key |= KEY_KEY1;
	lds R24,_s_key
	ori R24,1
	sts _s_key,R24
	.dbline 21
; 		}
	xjmp L12
L11:
	.dbline 22
; 		else if( inp(USER_KEY1_PIN, USER_KEY1_PIN_NO) && (s_key & KEY_KEY1) )
	sbis 0x13,7
	rjmp L13
X2:
	lds R2,_s_key
	sbrs R2,0
	rjmp L13
X3:
	.dbline 23
; 		{
	.dbline 25
; 			//usart_puts("Key1 Released.\r\n");
; 			bsp_led_core_off(ledUserCore);
	clr R16
	xcall _bsp_led_core_off
	.dbline 26
; 			s_key &= ~KEY_KEY1;
	lds R24,_s_key
	andi R24,254
	sts _s_key,R24
	.dbline 27
; 		}
L13:
L12:
	.dbline 28
; 		if( !inp(USER_KEY2_PIN, USER_KEY2_PIN_NO) && !(s_key & KEY_KEY2) )
	sbic 0x1,4
	rjmp L15
X4:
	lds R2,_s_key
	sbrc R2,1
	rjmp L15
X5:
	.dbline 29
; 		{
	.dbline 31
; 			//usart_puts("Key2 Pressed.\r\n");
; 			bsp_led_bottom_on(ledUserBottom1);
	clr R16
	xcall _bsp_led_bottom_on
	.dbline 32
; 			s_key |= KEY_KEY2;
	lds R24,_s_key
	ori R24,2
	sts _s_key,R24
	.dbline 33
; 		}
	xjmp L16
L15:
	.dbline 34
; 		else if( inp(USER_KEY2_PIN, USER_KEY2_PIN_NO) && (s_key & KEY_KEY2) )
	sbis 0x1,4
	rjmp L17
X6:
	lds R2,_s_key
	sbrs R2,1
	rjmp L17
X7:
	.dbline 35
; 		{
	.dbline 37
; 			//usart_puts("Key2 Released.\r\n");
; 			bsp_led_bottom_off(ledUserBottom1);
	clr R16
	xcall _bsp_led_bottom_off
	.dbline 38
; 			s_key &= ~KEY_KEY2;
	lds R24,_s_key
	andi R24,253
	sts _s_key,R24
	.dbline 39
; 		}
L17:
L16:
	.dbline 40
; 		if( !inp(USER_KEY3_PIN, USER_KEY3_PIN_NO) && !(s_key & KEY_KEY3) )
	sbic 0x13,0
	rjmp L19
X8:
	lds R2,_s_key
	sbrc R2,2
	rjmp L19
X9:
	.dbline 41
; 		{
	.dbline 43
; 			//usart_puts("Key3 Pressed.\r\n");
; 			bsp_led_core_on(ledUserCore);
	clr R16
	xcall _bsp_led_core_on
	.dbline 44
; 			s_key |= KEY_KEY3;
	lds R24,_s_key
	ori R24,4
	sts _s_key,R24
	.dbline 45
; 		}
	xjmp L20
L19:
	.dbline 46
; 		else if( inp(USER_KEY3_PIN, USER_KEY3_PIN_NO) && (s_key & KEY_KEY3) )
	sbis 0x13,0
	rjmp L21
X10:
	lds R2,_s_key
	sbrs R2,2
	rjmp L21
X11:
	.dbline 47
; 		{
	.dbline 49
; 			//usart_puts("Key3 Released.\r\n");
; 			bsp_led_core_off(ledUserCore);
	clr R16
	xcall _bsp_led_core_off
	.dbline 50
; 			s_key &= ~KEY_KEY3;
	lds R24,_s_key
	andi R24,251
	sts _s_key,R24
	.dbline 51
; 		}
L21:
L20:
	.dbline 53
; 
; 		_delay_ms(20);
	ldi R16,20
	ldi R17,0
	xcall __delay_ms
	.dbline 54
; 	}
L9:
	.dbline 13
	lds R2,_s_exit
	tst R2
	brne X13
	xjmp L8
X13:
X12:
	.dbline -2
L7:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e main _main fV
	.even
_main::
	.dbline -1
	.dbline 59
; 
; }
; 
; void main(void)
; {
	.dbline 60
; 	bsp_led_gpio_init();
	xcall _bsp_led_gpio_init
	.dbline 61
; 	bsp_key_gpio_init();
	xcall _bsp_key_gpio_init
	.dbline 63
; 
; 	gpio_polling_key();
	xcall _gpio_polling_key
L24:
	.dbline 66
; 
; 	while(1)
; 	{
	.dbline 68
; 
; 	}
L25:
	.dbline 65
	xjmp L24
X14:
	.dbline -2
L23:
	.dbline 0 ; func end
	ret
	.dbend
; 
; }
